﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace GameName1
{
    class MainMenuScene : GameScene
    {
        private Texture2D _spaceInvadersLogoSprite;
        private Texture2D _backgroundSprite;

        private Texture2D _alien1Sprite;
        private Texture2D _alien2Sprite;
        private Texture2D _alien3Sprite;
        private Texture2D _alienBonusSprite;

        private SpriteFont _font2;

        private MouseState _mouseState;

        public override void LoadContent()
        {        
            base.LoadContent();

            _spaceInvadersLogoSprite = ContentManager.Load<Texture2D>("Sprites/space_invaders_logo");
            _backgroundSprite = ContentManager.Load<Texture2D>("Sprites/background");

            _alien1Sprite = ContentManager.Load<Texture2D>("Sprites/invader1");
            _alien2Sprite = ContentManager.Load<Texture2D>("Sprites/invader2");
            _alien3Sprite = ContentManager.Load<Texture2D>("Sprites/invader3");
            _alienBonusSprite = ContentManager.Load<Texture2D>("Sprites/invader_bonus");

            _font2 = ContentManager.Load<SpriteFont>("myFont2");                          
        }
        public override void UnloadContent()
        {
            base.UnloadContent();
            ContentManager.Unload();
        }

        public override void Update(GameTime gameTime)
        {
            _mouseState = Mouse.GetState();
            if ((_mouseState.X >= 262 && _mouseState.X <= 538) && (_mouseState.Y >= 470 && _mouseState.Y <= 490) &&
                _mouseState.LeftButton == ButtonState.Pressed)
            {
                UnloadContent();
                ScreenManager.GetInstance().CurrentScreen = new GameplayScene();
            }
        }
        public override void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(_backgroundSprite,Vector2.Zero,Color.White);
            spriteBatch.Draw(_spaceInvadersLogoSprite, new Vector2(220, 50), Color.White);
            spriteBatch.Draw(_alien2Sprite, new Vector2(300, 225), Color.White);
            spriteBatch.Draw(_alien1Sprite, new Vector2(300, 275), Color.White);
            spriteBatch.Draw(_alien3Sprite, new Vector2(300, 325), Color.White);
            spriteBatch.Draw(_alienBonusSprite, new Vector2(288, 383), Color.White);
            spriteBatch.DrawString(_font2, "  =  10 PTS", new Vector2(350, 225), Color.White);
            spriteBatch.DrawString(_font2, "  =  20 PTS", new Vector2(350, 275), Color.White);
            spriteBatch.DrawString(_font2, "  =  40 PTS", new Vector2(350, 325), Color.White);
            spriteBatch.DrawString(_font2, "  =  200 PTS", new Vector2(350, 375), Color.White);
            spriteBatch.DrawString(_font2, "PLAY SPACE INVADERS", new Vector2(262, 470), Color.White);
            
            if ((_mouseState.X >= 262 && _mouseState.X <= 538) && (_mouseState.Y >= 470 && _mouseState.Y <= 490))
                spriteBatch.DrawString(_font2, "PLAY SPACE INVADERS", new Vector2(262, 470), new Color(0, 255, 0));
        }
    }
}
